let flag:boolean = false;

let decLiteral:number = 666;
let hexLiteral:number = 0xf00d; //16 进制
let binaryLiteral:number = 0b1010; // 2进制
let octalLiteral:number = 0o741;// 8 进制

let username:string = "刘葵儿是我儿";
username = "sun"

let uname:string = "杨智宇";
let age:string = '20';
let sentence:string = `Hello,my name is ${uname}.
I'll be ${ age + 1 } years old next month.`;

let list:number[]=[1,2,3];
let arr:Array<number> =[1,2,3];122

let x:[string,number];
x=['hello',10]

console.log(x[0].substr(1))
//console.log(x[1].substr(1))

let y:[string,string];
y = ['hello','world'];
console.log(y[1].substr(-1))

console.log(x[1].toString());

enum Color {Yellow,Red,Blue}
let c: Color = Color.Yellow;

enum Color1 {Red=1,gray=2,Green=3}
let d:Color1 = Color1.Green 


let colorName: string = Color[2];
console.log(colorName);

let notSure:any = 4;
notSure.ifItExists()
notSure.toFixed()

// let prettySure:object = 4;
// prettySure.toFiexd()

let brr: any[] = [1, true, "free"];
brr[1] = 66

function warnUser(): void {
    console.log("This is my warning message");
}
let unusable: void = undefined;

let u: undefined = undefined;
let n: null = null;

// 返回never的函数必须存在无法达到的终点
function error(message: string): never {
    throw new Error(message);
}

// 推断的返回值类型为never
function fail() {
    return error("Something failed");
}

// 返回never的函数必须存在无法达到的终点
function infiniteLoop(): never {
    while (true) {
    }
}

declare function create(o: object | null|number|string|boolean|undefined): void;

create({ prop: 0 }); // OK
create(null); // OK 
create(42); // OK
create("string"); // OK
create(false); // OK
create(undefined); // OK